<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>导入数据文件</title>
  <style>
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      margin: 0;
      padding: 20px;
      min-width: 300px;
      background-color: #f5f5f5;
      color: #333;
    }
    .container {
      background-color: white;
      border-radius: 8px;
      padding: 20px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    h4 {
      text-align: center;
      color: #2c3e50;
      margin-top: 0;
      margin-bottom: 20px;
      font-size: 18px;
    }
    .file-info {
      margin: 15px 0;
      padding: 10px;
      border: 1px solid #e0e0e0;
      border-radius: 4px;
      min-height: 20px;
      background-color: #fafafa;
    }
    #fileName {
      font-weight: 500;
      word-break: break-all;
    }
    .status-message {
      margin-top: 10px;
      padding: 10px;
      border-radius: 4px;
      display: none;
    }
    .status-success {
      background-color: #d4edda;
      color: #155724;
      border: 1px solid #c3e6cb;
    }
    .status-error {
      background-color: #f8d7da;
      color: #721c24;
      border: 1px solid #f5c6cb;
    }
    button {
      width: 100%;
      padding: 12px;
      margin-top: 15px;
      background-color: #007bff;
      color: white;
      border: none;
      border-radius: 4px;
      font-size: 16px;
      cursor: pointer;
      transition: background-color 0.2s;
    }
    button:hover {
      background-color: #0056b3;
    }
    button:active {
      background-color: #004085;
    }
    button:disabled {
      background-color: #6c757d;
      cursor: not-allowed;
    }
    .loading-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(255, 255, 255, 0.7);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
      display: none;
    }
    .loading-spinner {
      width: 40px;
      height: 40px;
      border: 4px solid #f3f3f3;
      border-top: 4px solid #007bff;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }
  </style>
</head>
<body>
  <div class="container">
    <h4>导入数据文件</h4>
    
    <p>请选择要导入的 JSON 格式数据文件：</p>
    
    <input type="file" id="fileInput" accept=".json" style="display: none;">
    
    <div class="file-info">
      <strong>已选择的文件：</strong>
      <div id="fileName">(未选择文件)</div>
    </div>
    
    <div id="statusMessage" class="status-message"></div>
    
    <button id="openFileButton">选择并导入文件</button>
  </div>
  
  <div id="loadingOverlay" class="loading-overlay">
    <div class="loading-spinner"></div>
  </div>
  
  <script src="file_open.js"></script>
</body>
</html>